<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
       /* 1.Math数学方法 */
       //返回0-9之间任意一个随机数字
       var i = Math.random() * 10;
       var j = Math.floor(i);
       console.log(j);

       /* 2.Number数字方法 */
       //Number.fixed(2); 自带四舍五入技能
       var n = new Number(12.345);
       var n1 = n.toFixed(2); //保留两位小数，从小数第三位开始四舍五入
       console.log(n1); //12.35

       var m = new Number(12.3);
       var m1 = m.toFixed(2); //固定两位小数，位数不够，0来补齐
       console.log(m1); //12.30

    </script>
</body>
</html>